package com.cloudfun.campusshare.repo;

import com.cloudfun.campusshare.entity.DeviceCsqEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;

/**
 * Created by CodeGenerator on 2020/09/27
 */
public interface DeviceCsqRepo extends PagingAndSortingRepository<DeviceCsqEntity, String>,
        JpaSpecificationExecutor<DeviceCsqEntity> {

    DeviceCsqEntity findTopByImeiOrderByCreateTimeDesc(String imei);

    @Transactional
    int deleteByCreateTimeLessThan(LocalDateTime tenDaysAgo);
}